#include"mystdio.h"

int main()
{
    MYFILE* fp = myfopen("log.txt","w");
    const char* str = "hello world";
    int cnt = 500;
    while(cnt)
    {
        char buff[NUM] = {0};
        snprintf(buff,sizeof(buff),"%s %d",str,cnt--);
        //snprintf(buff,sizeof(buff),"%s %d\n",str,cnt--);
        myfwrite(buff,strlen(buff),1,fp);
        sleep(1);
        if(cnt % 5 == 0 )
            myfflush(fp);
        
    }


    myfclose(fp);
    return 0;
}
